package com.example.demo.stephanehumbertlucas;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.data.WriteCellData;
import lombok.Data;

@Data
public class WebData {
    @ExcelProperty("名称")
    private String name;
    @ExcelProperty("地址")
    private String address;
    @ExcelIgnore
    private String website;
    @ExcelProperty("网址")
    private WriteCellData<String> url;
    //根据这三个字段判断是否一样，用于去重
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof WebData)) {
            return false;
        }
        WebData other = (WebData) obj;
        return this.name.equals(other.name) && this.address.equals(other.address) && this.website.equals(other.website);
    }

    //根据这三个字段计算hash值，用于去重
    @Override
    public int hashCode() {
        return name.hashCode() + address.hashCode() + website.hashCode();
    }
}
